package com.brainhealth.customer.service;

import java.util.List;
import java.util.Map;

import com.brainhealth.common.enums.CustomerExerciseStatus;
import com.brainhealth.customer.domain.Customer;
import com.brainhealth.customer.domain.CustomerExercise;
import com.brainhealth.customer.domain.Exercise;
import com.brainhealth.customer.domain.NowCustomerExercise;
import com.brainhealth.customer.domain.vo.CustomerExerciseVO;
import com.brainhealth.customer.domain.vo.CustomerReportVO;
import com.brainhealth.customer.domain.vo.FinishExerciseVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 会员训练记录Service接口
 * 
 * @author wolong
 * @date 2023-05-09
 */
public interface ICustomerExerciseService 
{
    /**
     * 查询会员训练记录
     * @param customer
     * @param status
     * @return
     */
    CustomerExercise getCustomerExercise(Customer customer, CustomerExerciseStatus status);

    /**
     * 查询会员训练记录
     * 
     * @param customerExerciseId 会员训练记录主键
     * @return 会员训练记录
     */
    public CustomerExercise selectCustomerExerciseByCustomerExerciseId(Long customerExerciseId);

    /**
     * 查询会员训练记录列表
     * 
     * @param customerExercise 会员训练记录
     * @return 会员训练记录集合
     */
    public List<CustomerExercise> selectCustomerExerciseList(CustomerExercise customerExercise);

    /**
     * 查询训练订单列表
     * @param customer
     * @param status
     * @return
     */
    List<CustomerExercise> getCustomerExerciseList(Customer customer, CustomerExerciseStatus status);

    /**
     * 获取会员当前的训练记录的状态
     * @param customer
     * @return
     */
    List<CustomerExerciseVO> getCustomerExerciseListInfo(Customer customer);

    /**
     * 新增会员训练记录
     * 
     * @param customerExercise 会员训练记录
     * @return 结果
     */
    public int insertCustomerExercise(CustomerExercise customerExercise);

    /**
     * 修改会员训练记录
     * 
     * @param customerExercise 会员训练记录
     * @return 结果
     */
    public int updateCustomerExercise(CustomerExercise customerExercise);

    /**
     * 批量删除会员训练记录
     * 
     * @param customerExerciseIds 需要删除的会员训练记录主键集合
     * @return 结果
     */
    public int deleteCustomerExerciseByCustomerExerciseIds(Long[] customerExerciseIds);

    /**
     * 删除会员训练记录信息
     * 
     * @param customerExerciseId 会员训练记录主键
     * @return 结果
     */
    public int deleteCustomerExerciseByCustomerExerciseId(Long customerExerciseId);

    /**
     * 开始会员训练
     * @param request
     * @param customerExerciseId
     * @return
     */
    public Exercise startCustomerExercise(HttpServletRequest request, Long customerExerciseId);

    /**
     * 完成会员训练
     */
    public CustomerReportVO finishCustomerExercise(HttpServletRequest request, FinishExerciseVO finishExerciseVO);

    /**
     * 会员处理完成以后重置订单状态
     */
    boolean customerOrderReset(Customer customer, CustomerExercise customerExercise);

    /**
     * 会员重新处理
     * @param customerExercise
     * @param customer
     * @return
     */
    public boolean customerExerciseNextReset(CustomerExercise customerExercise, Customer customer);

    /**
     * 处理已经过期的会员训练
     */
    public void customerExerciseExpired();

    /**
     * 获取会员当前训练中或者已完成的一笔订单的训练记录
     * @param customer
     * @return
     */
    NowCustomerExercise getNowCustomerExerciseList(Customer customer);

    /**
     * 查询已训练次数& 剩余训练次数
     * @param customer
     * @return
     */
    Map<String, Long> getProgressMap(Customer customer);
}
